package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.advanced;

import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeSingleClientMessageTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;

/**
 * 接收服务端发送过来的聊天信息
 */
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeSingleClientMessageTypeAdvanced extends AbstractHandleUdpDistributeSingleClientMessageTypeAdvanced<NettyProxyMsg> {
    /**
     * 处理当前数据
     *
     * @param nettyChannelContext       当前通道
     * @param nettyProxyMsg 通道数据
     */
    @Override
    protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
        byte[] clientId = nettyProxyMsg.getClientId();
        byte[] data = nettyProxyMsg.getData();
        log.info("接收客户端：{},发送过来的聊天信息:{}", new String(clientId), new String(data));

    }
}
